<?

function _template_list_begin ($container) {

	print <<<HTML
<div id="{$container->get_variable ("list_id")}">
<table class="vmc_list_a" border="0" cellpadding="2" cellspacing="0">

HTML;

	if ($list_title = $container->get_variable ("list_title")) {
		
	print <<<HTML
<tr><td class="vmc_list_title" colspan="{$container->get_variable ("column_count")}">{$list_title}</td></tr>

HTML;
	}
}

function _template_list_options_begin ($container) {

	print <<<HTML

<tr>
	<td class="vmc_list_options" align="left" colspan="{$container->get_parent ()->get_variable ("column_count")}">

<br>
<table class="vmc_form_a" border="0" cellpadding="2" cellspacing="0" width="100%">

HTML;
}

function _template_list_option ($container) {

	print <<<HTML
	<form action="{$container->get_option ("link")}" method="POST"><td width="10"><input class="vmc_list_option" type="submit" value="{$container->get_option ("label")}"></td></form>

HTML;
}

function _template_list_options_end ($container) {

	$scroll_options = array ();
	$object_id = $container->get_variable ("object_id");

	if ($container->get_variable ($object_id . "_page") > 1) {

		$scroll_a =<<<HTML
<a href="?{$object_id}_page=1&{$object_id}_action=first{$container->get_variable ("link_options")}"><img border="0" src="/img/arrow1b.gif" alt="First Page"></a>
HTML;
	} else {

		 $scroll_a = <<<HTML
<img border="0" src="/img/arrow1a.gif">
HTML;
	}

	if ($container->get_variable ($object_id . "_prev")) {

		$scroll_b = <<<HTML
<a href="?{$object_id}_action=prev&{$object_id}_page={$container->get_variable ($object_id . "_page")}{$container->get_variable ("link_options")}"><img border="0" src="/img/arrow2b.gif" alt="Previous Page"></a>
HTML;
	} else {

		$scroll_b = <<<HTML
<img border="0" src="/img/arrow2a.gif"></a>
HTML;
	}

	if ($container->get_variable ($object_id . "_next")) {

		$scroll_c = <<<HTML
<a href="?{$object_id}_action=next&{$object_id}_page={$container->get_variable ($object_id . "_page")}{$container->get_variable ("link_options")}"><img border="0" src="/img/arrow3b.gif" alt="Next Page"></a>
HTML;
	} else {

		$scroll_c = <<<HTML
<img border="0" src="/img/arrow3a.gif">
HTML;
	}

	if ($container->get_variable ($object_id . "_page") <
			$container->get_variable ($object_id . "_pages")) {

		$scroll_d = <<<HTML
<a href="?{$object_id}_page={$container->get_variable ($object_id . "_pages")}&{$object_id}_action=last{$container->get_variable ("link_options")}"><img border="0" src="/img/arrow4b.gif" alt="Last Page"></a>
HTML;
	} else {

		$scroll_d = <<<HTML
<img border="0" src="/img/arrow4a.gif">
HTML;
	}

	print <<<HTML
	<td class="" width="100%" align="right">&nbsp;</td>
	<td style="font-size:8px;" align="right" valign="center">{$scroll_a}&nbsp;&nbsp;{$scroll_b}&nbsp;&nbsp;{$scroll_c}&nbsp;&nbsp;{$scroll_d}&nbsp;&nbsp;</td>
</tr>
</table>

	</td>
</tr>

HTML;
}

function _template_list_end ($container) {

	print <<<HTML
</table>
</div>


HTML;
}

function _template_list_indexes_begin ($container) {

	print <<<HTML
<tr class="vmc_list_indexes">

HTML;
}

function _template_list_indexes_end ($container) {

	print <<<HTML
</tr>

HTML;
}

function _template_list_index ($container) {

	print <<<HTML
	<td class="{$container->get_variable ("class_a")}" valign="center" onmouseover="javascript: this.className='{$container->get_variable ("class_b")}';" onmouseout="javascript: this.className='{$container->get_variable ("class_a")}';"><a class="vmc_indexing" href="?{$container->get_variable ("list_id")}_order={$container->get_variable ("order")}{$container->get_variable ("link_options")}"><img hspace="4" border="0" src="/img/{$container->get_variable ("image")}">{$container->get_variable ("label")}</a></td>

HTML;
}

function _template_list_row_begin ($container) {

#<tr onmouseover="javascript: this.className = 'vmc_cell_b';" onmouseout="javascript: this.className = 'vmc_cell_a';">
	$class = $container->get_option ("class");

	print <<<HTML
<tr class="{$class}" onmouseover="javascript: this.className='vmc_list_control_row_b';" onmouseout="javascript: this.className='{$class}';">

HTML;
}

function _template_list_row_end ($container) {

	print <<<HTML
</tr>

HTML;
}

function _template_list_row_column ($container) {

	$column = $container->get_variable ("column");
	$align = isset ($column["align"]) ? $column["align"] : "left";

	if (isset ($column["callback"]) && function_exists ($column["callback"])) {

		if ($value = $column["callback"] ($container, $column))

			$container->set_variable ("value", $value);
		else return;
	} else {

		$value = $container->get_variable ("value");
		$value = strlen ($value) > 16 ? substr ($value, 0, 13) . "..." : $value;
	}

	if ($container->get_variable ("object_ctl_off")) {

		$href = null;
	} else $href = " href=\"{$container->get_variable ("object_ctl")}\"";

	print <<<HTML
	<td align="$align" class="vmc_list_control_column_a"><a class="vmc_list_control_column_a"{$href}>{$value}</a></td>

HTML;
}

function _template_list_substring ($container, $column) {

	$value = $container->get_variable ("value");
	return substr ($value, 1, $column["length"]) . (strlen ($value) < $column["length"] ? "" : "...");
}

function _template_list_image_value ($container, $column) {

	if (!file_exists ("{$_SERVER["DOCUMENT_ROOT"]}/{$column["path"]}/" .
			"{$container->get_variable("value")}.jpg"))
		return "&nbsp;";

	if ($container->get_variable ("object_ctl_off")) {

		$href = null;
	} else $href = " href=\"{$container->get_variable ("object_ctl")}\"";

	print <<<HTML
	<td align="center" class="vmc_list_control_column_a"><a class="vmc_list_control_column_a"{$href}><img  border=
"0" src="/scale.php?path={$column["path"]}/{$container->get_variable("value")}.jpg&scale={$column["scale"]}"></a></td>

HTML;

}

?>
